package cn.team11.smarteye.adapter;

import android.content.Context;

import cn.team11.sds.dayi.R;

import org.apache.commons.lang3.StringUtils;

import java.util.List;

import cn.team11.smarteye.bean.CateyeInfoBean;

/**
 * Created by Yang on 2017/10/30.
 */

public class CateyeDevListAdapter extends CommonAdapter<CateyeInfoBean>{


    public CateyeDevListAdapter(Context mContext, int mLayoutId, List<CateyeInfoBean> mDatas) {
        super(mContext, mLayoutId, mDatas);
    }


    @Override
    public void convert(CommonViewHolder holder, CateyeInfoBean cateyeDeviceBean) {
        if (StringUtils.isEmpty(cateyeDeviceBean.getNick())){
            holder.setText(R.id.device_name,mContext.getString(R.string.smart_cateye));
        } else {
            holder.setText(R.id.device_name,cateyeDeviceBean.getNick());
        }
        holder.setText(R.id.device_online_status, cateyeDeviceBean.getStatus() == 0 ? "设备离线" : "设备在线");
    }


    @Override
    public void onBindViewHolder(CommonViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
    }

}
